#include<iostream>
using namespace std;

struct Node{
    int loc, val;
}a[522];
//a[1<<(n+1) + 10]

Node max(Node a, Node b) {
    if(a.val > b.val) return a;
    else if(a.val < b.val) return b;
}

int main() {
    int n;
    cin >> n;
    for(int i=1<<n; i<(1<<(n+1)); i++) {
        cin >> a[i].val;
        a[i].loc = i - (1<<n) + 1;
    }
    for(int i=(1<<n)-1; i>=1; i--) {
        a[i] = max(a[i<<1], a[i<<1|1]);
    }
    if(a[2].val > a[3].val) cout << a[3].loc;
    else cout << a[2].loc;
    return 0;
} 